{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>酒店列表</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <div  class="col-sm-3">
                        <div class="input-group" >
                            <a href="{:url('roomtypeadd')}">
                                <button type="button" class="btn btn-primary btn-outline"  >
                                    <i class="fa fa-plus"></i> 房间类型添加
                                </button>
                            </a>
                            <!--<button  class="btn btn-outline btn-danger" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                            <!--</button>-->
                            <!--<ul class="dropdown-menu animated fadeInDown" role="menu">-->
                            <!--&lt;!&ndash;<li><a href="javascript:;" class="layuiBtn" id="empty" data-type="reload"><i class="fa fa-retweet"></i> 重置搜索框 </a></li>&ndash;&gt;-->
                            <!--<li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>-->
                            <!--</ul>-->
                        </div>
                    </div>
                    <div class="col-sm-9">
                        <!--<form id="layuiForm">-->
                            <!--<div class="col-sm-4">-->
                                <!--<div class="input-group" >-->
                                    <!--<input type="text" id="key" class="form-control search" name="key" value="" placeholder="酒店名字|酒店名字"/>-->
                                    <!--<span class="input-group-btn">-->
                                        <!--<a  class="btn btn-primary layuiBtn" data-type="reload"><i class="fa fa-search"></i> 搜索</a>-->
                                    <!--</span>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</form>-->

                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Hotel/roomtype")}'
            , page: true
            , even: false //开启隔行背景
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            // ,width:100
            , cellMinWidth: 80
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , text: {
                none: '暂无数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
            }
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type:'numbers', width: 60, title: '序号'}
                , {field: 'c_id', width: 60, title: 'ID', sort: true, align: 'center'}
                , {field: 'cate_name', width: '', title: '分类名称', align: 'center'}
                , {field: 'h_name', width: '', title: '酒店名称', align: 'center'}
                , {fixed: 'right', width: '', title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $.each(res.data,function(index,item){
                    $('#view_'+item['banner_id']).viewer({
                        url: 'data-original',
                    });
                });
            }
        });

        //搜索表格重载
        var $ = layui.$, active = {
            reload: function () {
                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where:$('#layuiForm').parseForm()
                });
            }

        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['c_id'])
            });
            return ids;
        }
    });
</script>
<!--操作模板-->
<script type="text/html" id="opeBar">
    <a href="javascript:location.href = '{:url('roomtypeupdate')}?id={{d.c_id}}';" class="btn btn-primary btn-outline btn-xs"><i class="fa fa-paste"></i> 编辑</a>&nbsp;
</script>
</body>
</html>